package com.ultrawise.survey.common.filter;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

import org.dom4j.DocumentHelper;
import org.dom4j.Element;

public class HttpServiceUtil {
	/**
	 * 提示信息
	 * 
	 * @param response
	 * @param msgValue
	 * @throws IOException
	 */
	public static void showMessage(HttpServletResponse response, String msgValue)
			throws IOException {
		response.setCharacterEncoding("UTF-8");
		response.setContentType("text/html");

		PrintWriter out = response.getWriter();
		Element element = DocumentHelper.createElement("html");
		Element head = DocumentHelper.createElement("head");

		Element meta = DocumentHelper.createElement("meta");
		meta.addAttribute("http-equiv", "Content-Type");
		meta.addAttribute("content", "text/html; charset=UTF-8");
		head.add(meta);
		element.add(head);

		Element body = DocumentHelper.createElement("body");
		//body.setText(msgValue);
		element.add(body);
		String backa = msgValue+"<br/><a href='javascript:history.go(-1)'>返回</a>";
		out.write(element.asXML() + backa);
		out.close();
	}

}
